In [2]:
import sys
sys.path.append('..')
from data.dataset import DATASET, DATASET_PATH
from utils.geo import get_elevation,get_place
In [3]:
DATASET['elevation'] = DATASET.progress_apply(lambda city: get_elevation(city['latitude'],city['longitude']),axis=1)
In [4]:
DATASET['elevation']
Out[4]:
0          2
1          1
2          5
3         14
4          2
        ... 
1206       1
1207     426
1208   -9999
1209      80
1210      84
Name: elevation, Length: 1210, dtype: int64
In [5]:
DATASET.sort_values(by='elevation').iloc[-10:][['city','country','latitude','longitude','elevation']]
Out[5]:
city country latitude longitude elevation
191 Addis Ababa Ethiopia 9.0272 38.7369 2428
1193 Thimphu Bhutan 27.4833 89.6333 2434
646 Sopó Colombia 4.9075 -73.9384 2496
970 Cuenca Ecuador -2.8974 -79.0045 2499
949 Cochabamba Bolivia (Plurinational State of) -17.3935 -66.1570 2575
974 Quito Ecuador -0.2186 -78.5097 2745
954 Sucre Bolivia (Plurinational State of) -19.0431 -65.2592 2759
33 Breckenridge United States of America 39.4995 -106.0433 2925
950 La Paz Bolivia (Plurinational State of) -16.4942 -68.1475 3845
951 Oruro Bolivia (Plurinational State of) -17.9667 -67.1167 3960
In [6]:
DATASET.sort_values(by='elevation').iloc[:10][['city','country','latitude','longitude','elevation']]
Out[6]:
city country latitude longitude elevation
207 Sydney Australia -33.8650 151.2094 -9999
1167 Male Maldives 4.1750 73.5083 -9999
1166 Majuro Marshall Islands 7.1167 171.3667 -9999
380 Colombo Sri Lanka 6.9167 79.8333 -9999
517 Labasa Fiji -16.4333 179.3667 -9999
693 Tyre Lebanon 33.2667 35.2000 -9999
1149 Luganville Vanuatu -15.5126 167.1766 -9999
692 Tripoli Lebanon 34.4333 35.8333 -9999
210 Aden Yemen 12.8000 45.0333 -9999
1141 Trujillo Honduras 15.9167 -86.0000 -9999
In [8]:
DATASET.loc[DATASET['elevation'] == -9999, 'elevation'] = 0
In [9]:
DATASET.sort_values(by='elevation').iloc[:10][['city','country','latitude','longitude','elevation']]
Out[9]:
city country latitude longitude elevation
96 Mecca United States of America 33.5767 -116.0645 -39
554 Baku Azerbaijan 40.3667 49.8352 -12
329 Rotterdam Netherlands 51.9200 4.4800 -4
326 Amsterdam Netherlands 52.3500 4.9166 -2
207 Sydney Australia -33.8650 151.2094 0
1167 Male Maldives 4.1750 73.5083 0
1166 Majuro Marshall Islands 7.1167 171.3667 0
380 Colombo Sri Lanka 6.9167 79.8333 0
517 Labasa Fiji -16.4333 179.3667 0
693 Tyre Lebanon 33.2667 35.2000 0
In [10]:
DATASET.to_csv(DATASET_PATH)